﻿using System;
using System.Collections.Generic;
using System.Text;

using ET;
using Server;
using Demo;

namespace Marx
{
    public class Startup : IMarxStartup
    {
        public void UseDLL(IConfiguration app)
        {
            app.UseDLL(typeof(ServerCore).Assembly);
            app.UseDLL(typeof(ServerCommon).Assembly);
            app.UseDLL(typeof(ServerProtocol).Assembly);
            app.UseDLL(typeof(ServerTemplate).Assembly);
            app.UseDLL(typeof(ServerThirdParty).Assembly);

            app.UseDLL(typeof(Gate).Assembly);
            app.UseDLL(typeof(Handler).Assembly);
            app.UseDLL(typeof(Logic).Assembly);
            app.UseDLL(typeof(Realm).Assembly);
            app.UseDLL(typeof(Service).Assembly);

            app.UseDLL(typeof(Startup).Assembly);
        }

        public void Configure(IConfiguration app, IMarxEnvironment env)
        {
            ServerConfigration.Instance.Initializer("./ServerConfig.xml");

            app.UseTcp();
            app.UseHeartbeatCheck(2000, 10000);
            
            app.UseDB();

            app.UseComponent<AppPingComponent>(MarxSceneType.Process);
            app.UseComponent<ProcessReadyComponent>(MarxSceneType.Process);

            app.UseComponent<ServiceLoader>(ServerSceneType.Service);
            app.UseComponent<GateSelectorComponent>(MarxSceneType.Realm);
            app.UseComponent<LoginTokenComponent>(MarxSceneType.Gate);
            app.UseComponent<PlayerManager>(ServerSceneType.Logic);
            app.UseComponent<PlayerCreatorComponent>(MarxSceneType.Gate);
        }
    }
}
